package com.youyou.login.feign.fallback;

import com.youyou.login.feign.LoginFeign;
import feign.hystrix.FallbackFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

/**
 * 熔断降级工厂
 *
 * @author 刘朋
 * <br/>date 2021-11-10
 */
@Slf4j
@Component
public class LoginFeignFallbackFactory implements FallbackFactory<LoginFeign> {
    @Override
    public LoginFeign create(Throwable throwable) {
        return () -> {
            log.error("远程调用异常",throwable);
            return "进行熔断";
        };
    }
}
